package com.cskaoyan.mall.payment.alipay;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class PayHelperFactory {
    @Autowired
    AliPayHelper aliPayHelper;
    @Autowired
    WeChatPayHelper weChatPayHelper;

    public PayHelper createPayHelper(String payType){
        //这个地方工厂如果多的话其实可以改成一个hashMap进行存储
        if (PayTypeEnum.ALI.name().equals(payType)){
            return aliPayHelper;
        }else if (PayTypeEnum.WECHAT.name().equals(payType)){
            return weChatPayHelper;
        }
        return null;
    }

}
